package com.heima.article.client;

import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.dtos.AuthorDto;
import com.heima.model.media.dtos.WmNewsResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author RMY
 * @Date 2021/11/26 17:15
 * @Version 1.0
 */
@FeignClient("leadnews-article")
public interface ArticleFeign {

    /**
     * 保存作者
     * @param authorDto
     * @return
     */
    @PostMapping("/api/v1/author/save")
    Integer save(@RequestBody AuthorDto authorDto);


    @PostMapping("/api/v1/article/save")
    Long saveArticle(@RequestBody WmNewsResultDTO dto);

    /**
     * 分页查询文章信息
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/api/v1/article/findByPage")
    List<ArticleDto> findArticleByPage(@RequestParam(name = "page") int page,
                                       @RequestParam(name = "size") int size);
}
